<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/user/userBase.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/area.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
	            <dl>
					<dt>省：</dt>
					 <dd>
	                	<select name="provinceId" id="provinceId" onchange="admin.area.changeProvince()" class="txt grid-8">
	                		<c:forEach var="province" items="${provinceList}">  
                                <option value="${province.id}">${province.name}</option>  
                            </c:forEach>
	                	</select>
	                </dd>
				</dl>
				<dl>
					<dt>市：</dt>
					 <dd>
	                	<select name="cityId" id="cityId" onchange="admin.area.changeCity()" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                	</select>
	                </dd>
				</dl>
				<dl>
					<dt>区：</dt>
					 <dd>
	                	<select name="areaId" id="areaId" onchange="admin.area.changeArea()" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                	</select>
	                </dd>
				</dl>
				<dl>
					<dt>社区：</dt>
					<dd>
						<select name="communityId" id="communityId" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                	</select>
					</dd>
				</dl>
				<dl>
					<dt>昵称：</dt>
					<dd>
						<input name="nick" id="nick" type="text" class="txt" maxlength="16"/>
					</dd>
				</dl>
				<p class="cl"></p>
				<dl>
					<dt>帐号：</dt>
					<dd>
						<input name="searchMore" id="searchMore" type="text" class="txt" maxlength="32"/>
					</dd>
				</dl>
				
				<dl>
	            	<dt>注册时间：从</dt>
	                <dd>
		                <input name="startAtStr" id="startAtStr" type="text" class="txt easyui-datetimebox" maxlength="19"/> 到 
		                <input name="endAtStr" id="endAtStr" type="text" class="txt easyui-datetimebox" maxlength="19"/>
	                </dd>
	            </dl>
				<dl>
					<dt>身份认证：</dt>
					<dd>
						<select name="hasIdentityAuth" id="hasIdentityAuth" class="txt grid-8">
							<option value="">请选择</option>
							<option value="1">已认证</option>
							<option value="2">未认证</option>
						</select>
					</dd>
				</dl>
				<p class="cl"></p>
				<dl>
					<dt>荣誉值：</dt>
					<dd>
						<input name="honorValueStart" id="honorValueStart" type="text" class="txt" maxlength="16" oninput="intBlur(this)" onpropertychange="intBlur(this)"/>
						--
						<input name="honorValueEnd" id="honorValueEnd" type="text" class="txt" maxlength="16" oninput="intBlur(this)" onpropertychange="intBlur(this)"/>
					</dd>
				</dl>
				<dl>
					<dt>排序：</dt>
					<dd>
						<select name="sortField" id="sortField" class="txt grid-8">
							<option value="">请选择</option>
							<option value="honorValue">荣誉值</option>
							<option value="quanValue">圈币</option>
							<option value="money">余额</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt>顺序：</dt>
					<dd>
						<select name="sortDirection" id="sortDirection" class="txt grid-8">
							<option value="DESC" selected="selected">高到低</option>
							<option value="ASC">低到高</option>
						</select>
					</dd>
				</dl>
				<p class="cl"></p>
				<dl>
					<dt>圈币：</dt>
					<dd>
						<input name="quanValueStart" id="quanValueStart" type="text" class="txt" maxlength="16" oninput="intBlur(this)" onpropertychange="intBlur(this)"/>
						--
						<input name="quanValueEnd" id="quanValueEnd" type="text" class="txt" maxlength="16" oninput="intBlur(this)" onpropertychange="intBlur(this)"/>
					</dd>
				</dl>
				<dl>
					<dt>余额：</dt>
					<dd>
						<input name="moneyStart" id="moneyStart" type="text" class="txt" maxlength="16" oninput="intBlur(this)" onpropertychange="intBlur(this)"/>
						--
						<input name="moneyEnd" id="moneyEnd" type="text" class="txt" maxlength="16" oninput="intBlur(this)" onpropertychange="intBlur(this)"/>
					</dd>
				</dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.userBase.query()" />
	            </p>
	            <dl></dl>
	            <p class="search_form_btn">
	            	<input type="button" value="导出excel" class="icon_serach" onclick="admin.userBase.export2Excel()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/user/base/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'nick',width:100,align:'center'">昵称</th>
						<th data-options="field:'sexDesc',width:100,align:'center'">性别</th>
						<th data-options="field:'communityName',width:100,align:'center'">所属社区</th>
						<th data-options="field:'typeDesc',width:100,align:'center' ">帐号类型</th>
						<th data-options="field:'userIdentity',width:150,align:'center' ">帐号</th>
						<th data-options="field:'talentCount',width:100,align:'center' ">发帖数</th>
						<th data-options="field:'totalCommentCount',width:100,align:'center' ">用户评论数</th>
						<th data-options="field:'totalPraiseCount',width:100,align:'center' ">点赞数</th>
						<th data-options="field:'honorValue',width:150,align:'center' ">荣誉值</th>
						<th data-options="field:'honorLevel',width:80,align:'center' ">荣誉等级</th>
						<th data-options="field:'quanValue',width:100,align:'center' ">圈币</th>
						<th data-options="field:'money',width:100,align:'center' ">余额</th>
						<th data-options="field:'couponCount',width:100,align:'center' ">代金卷数量</th>
						<th data-options="field:'orderCount',width:100,align:'center' ">订单数量</th>
						<th data-options="field:'strNewAt',width:150,align:'center'">注册时间</th>
						<th data-options="field:'interests',width:200,align:'center' ">兴趣</th>
						<th data-options="field:'hometown',width:200,align:'center'">家乡</th>
						<th data-options="field:'delicacys',width:200,align:'center' ">美食</th>
						<th data-options="field:'profession',width:200,align:'center'">行业</th>
						<th data-options="field:'graduateSchool',width:180,align:'center'">学校</th>
						<th data-options="field:'entertainment',width:180,align:'center' ">娱乐</th>
						<th data-options="field:'isOfficial',width:80,align:'center',formatter:formatIsOfficial ">是否官方用户</th>
						<th data-options="field:'isOnlineService',width:80,align:'center',formatter:formatIsOnlineService ">是否在线客服</th>
						<th data-options="field:'hasIdentityAuth',width:80,align:'center',formatter:formatHasIdentityAuth ">身份认证</th>
			            <th data-options="field:'id',align:'center',width:400,formatter:formatOperation">操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>

	<script>
	function formatIsOnlineService(value,row,index) {
		var l_html = '';
		if (value==1) {
			l_html = '在线客服';
		}else{
			l_html = '否';
		}
		return l_html;
	}
	function formatIsOfficial(value,row,index) {
		var l_html = '';
		if (value==1) {
			l_html = '官方';
		}else{
			l_html = '否';
		}
		return l_html;
	}
	function formatHasIdentityAuth(value,row,index) {
		var l_html = '未认证';
		if (value==1) {
			l_html = '已认证';
		}
		return l_html;
	}
	function formatOperation(value,row,index) {
		var isOfficial = row.isOfficial;//1:官方；2:非官方
		var isOnlineService = row.isOnlineService;//1:在线客服；2:否
		var l_html = '';
		l_html += '<a href="javascript:;" class="table_link" onclick="admin.userBase.detail('+row.id+')">用户详情</a>';
		l_html += '|<a href="javascript:;" class="table_link" onclick="admin.userBase.auth('+row.id+')">身份认证</a>';

		l_html += '|<a href="javascript:;" class="table_link" onclick="admin.userBase.authCommunity('+row.id+')">社区住户认证</a>';
		if(isOfficial=="1"){
			l_html += '|<a href="javascript:;" class="table_link" onclick="admin.userBase.setNotOfficial('+row.id+')">取消官方</a>';
		}else{
			l_html += '|<a href="javascript:;" class="table_link" onclick="admin.userBase.setIsOfficial('+row.id+')">设为官方</a>';
		}
		if(isOnlineService=="1"){
			l_html += '|<a href="javascript:;" class="table_link" onclick="admin.userBase.setNotOnlineService('+row.id+')">取消在线客服</a>';
		}else{
			l_html += '|<a href="javascript:;" class="table_link" onclick="admin.userBase.setIsOnlineService('+row.id+')">设为在线客服</a>';
		}
		return l_html;
	}

	
	function intBlur(oInput){
		var s=oInput.value;
		var num=parseInt(oInput.value);
		if(isNaN(num)||num<0) num=0;
		if(s!=num) oInput.value=num;
	}
	
	
	</script>
  </body>
</html>
